package com.open.capacity.controller;

import com.open.capacity.common.entity.PlaceModel;
import com.open.capacity.common.web.Result;
import com.open.capacity.service.PlaceService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/place")
public class PlaceController {
    @Autowired
    private PlaceService placeService;

    @GetMapping("/findStar")
    public Object findStar(){
        List<PlaceModel> placeModelList=placeService.findStar();
        return Result.succeed(placeModelList,"操作成功");
    }

    @GetMapping("/findAll")
    public Object findAll(PlaceModel placeModel){
        List<PlaceModel> placeModelList=placeService.findAll(placeModel);
        Integer count=placeService.count(placeModel);
        Map map=new HashMap();
        map.put("list",placeModelList);
        map.put("count",count);
        return Result.succeed(map,"操作成功");
    }
    @GetMapping("/findById")
    public Object findById(PlaceModel placeModel){
        List<PlaceModel> placeModelList=placeService.findById(placeModel);
        return Result.succeed(placeModelList,"操作成功");
    }


}
